public class Teacher {
    // 自定义属性
    private String teacherId;   // 教师编号
    private String teacherName; // 教师姓名
    private String gender;      // 性别
    private String title;       // 教师职称
    private Course taughtCourse;// 所授课程
    public Teacher(String teacherId, String teacherName, String gender, String title) {
        this.teacherId = teacherId;
        this.teacherName = teacherName;
        this.gender = gender;
        this.title = title;
    }
    //开设课程
    public void openCourse(Course course) 
    {
        if (course.getTeacherId().equals(this.teacherId)) {
            this.taughtCourse = course;
            System.out.println("【开课成功】教师" + teacherName + gender + "性" + "（" + title + "）开设课程：" + course.getCourseName());
        } else {
            System.out.println("【开课失败】课程关联教师编号与当前教师不匹配");
        }
    }
    public String getTeacherId() { return teacherId; }
    public String getTeacherName() { return teacherName; }
    public Course getTaughtCourse() { return taughtCourse; }
}